/**
*      author: Y_Yao
*      created: 2025-05-22 21:03:48
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 9e18;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 7;
int a[N];
int n,k;
string s;
int cnt0 = 0;

void solve()
{
    cnt0 = 0;
    cin >> n >> k;
    cin >> s;
    s = " " + s; 
    for(int i = 1;i <= n;i++)
    {
        if(s[i] == '0') cnt0++;
    }

    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
    }

    int presum = 0;
    int minsum = 0;
    bool flag = false;
    for(int i = 1;i <= n;i++)
    {
        if(s[i] == '0')
        {
            presum = minsum = 0;
            continue;
        }
        presum += a[i];
        int tsum = presum - minsum;
        if(tsum > k)
        {
            cout << "No" << endl;
            return;
        }
        if(tsum == k) flag = true;
        minsum = min(minsum,presum);
    }

    if(cnt0 == 0)
    {
        if(flag)
        {
            cout << "Yes" << endl;
            for(int i = 1;i <= n;i++)
            {
                cout << a[i] << " ";
            }
            cout << endl;
            return;
        }
        else
        {
            cout << "No" << endl;
            return;
        }
    }

    cout << "Yes" << endl;
    bool flag1 = false;
    for(int i = 1;i <= n;i++)
    {
        if(s[i] == '0')
        {
            if(!flag1)
            {
                int l = i - 1;
                int sum1 = 0;
                int sufsum = 0;
                while(l >= 1 && s[l] == '1')
                {
                    sufsum += a[l];
                    sum1 = max(sum1,sufsum);
                    l--;
                }

                int r = i + 1;
                int sum2 = 0;
                int psum = 0;
                while(r <= n && s[r] == '1')
                {
                    psum += a[r];
                    sum2 = max(sum2,psum);
                    r++;
                }

                int x = k - sum1 - sum2;
                flag1 = true;
                cout << x << " ";
            }
            else
            {
                cout << -INF << " ";
            }

        }
        else cout << a[i] << " ";
    }
    cout << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}